home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_45 / readme < prev    next >
Text File  |  1995-01-01  |  14KB  |  355 lines

  1. Mod Disassembler v 0.00
  2.  
  3. Introduction:
  4.  
  5. This program is used to dis-assemble a .mod file.  It creates a human
  6. readable file describing everything in the .mod file.
  7.  
  8. It can optionally dump the samples in separate files in .wav or raw
  9. format.  The wav and raw formats can be used by other sound editing
  10. programs, and can easily be converted into other formats by conversion
  11. utilities such as sox.
  12.  
  13. The dis-assembled mod file can be viewed or edited.  A companion program
  14. modcomp can re-assemble the mod file.  (modcomp is not yet available as of
  15. the date of this writing).  Mod_dis and modcomp can be used to compose
  16. or modify mod files using any standard text editor, and can be used on
  17. any machine, even those that cant play the files.
  18.  
  19. Mod_dis has been successfully compiled and tested on
  20.     * unix - IRIX (SGI), SunOs 4.1.1 (Sun)
  21.     * msdos
  22.  
  23. The source code is provided.  Other ports are encouraged.  Send me some
  24. e-mail if you successfully port to a machine mot listed above.
  25.  
  26. The msdos executable is included for immediate use by those without
  27. compilers.
  28.  
  29. The program is freely distributible provided the copyright notices
  30. remain intact.
  31.  
  32. Usage: mod_dis [options] file.mod >file.dis
  33.  options:
  34.   -c n = set number of channels (aka voices, tracks) to n
  35.   -i n = set number of instruments (aka samples) to n
  36.       without -c and -i, mod_dis will attempt to figure out
  37.       the file format
  38.     Note: you normally do not need to set a -c or -i, however in
  39.           rare circumstances where a mod file is known to be good,
  40.           however has an unknown tag, you can try setting -c and -i
  41.           to dis-assemble.
  42.  
  43.   -np = do not disassemble patterns
  44.   -ns = do not disassemble samples
  45.     Note: by default patterns and samples are dis-assembled.  However,
  46.            if you want to just see some header information, you can
  47.           specify -np -ns to give you a more compact file.
  48.  
  49.   -u  = unused patterns
  50.       sometimes there are more patterns in the file than are actually used
  51.       in the song.  By default these are ignored.  With the -u flag they are
  52.       disassembled.
  53.  
  54.     Note: If you specify -np, you will not get any patterns dis-assembled.
  55.  
  56.   -v = verbose (another -v = more verbose)
  57.  
  58.     Note: Normally only errors are reported to the error output (your
  59.           terminal).  -v will also report some internal program
  60.           diagnostics as well as warnings.  -v -v will give you even
  61.           more.
  62.  
  63.     Note:    Additional comments may be placed in the disassembled
  64.         output when you use -v.
  65.  
  66.   -f x = format of samples, values of x are:
  67.          i=internal, s=raw samples (.sam),
  68.          a=ascii (.txt), w=Microsoft wave (.wav)
  69.          w1=.wav at 11025 Hz
  70.  
  71.     Note:    -ns will override the -f flag.
  72.     Note:    -f i is the default, causing sample values to be
  73.         dumped in a textual format at the end of the
  74.         dis-assembled output.  You can redirect the
  75.         sample dump to another file by specifying one
  76.         of the other -f switches.
  77.     Note:    The name of the external file can be controlled
  78.         with the -p switch.
  79.     Note:    If there are more than one instrument in the source
  80.         file (very likely), you will get multiple sample
  81.         files.
  82.     Note:    The .sam format is simply a stream of unsigned 8-bit
  83.         values.
  84.     Note:    The .wav file is encoded to play back at 16574 samples/sec.,
  85.         which corresponds to the standard C-3 playback rate.  If your
  86.         sound card or wav editor doesnt like this rate, you can
  87.         use the -f w1 flag to create a .wav file which will
  88.         play back at the standard 11025 Hz, the tone of the
  89.         resultant sample will be lowered somewhat when played
  90.         back, mod_dis does not adjust do any re-sampling to
  91.         compensate.
  92.     Note:    Some features of the instruments are not placed in
  93.         the sample files, like finetune, repeats, volume, etc...
  94.         Hence playback software is not likely to reproduce
  95.         the same sound as the sample when played as part of the
  96.         .mod file.
  97.         However the standard .wav file will include an INFO block
  98.         which will encode these values into the "comment" field.
  99.         The modcomp software will make use of this specially
  100.         formatted comment.
  101.     Note:    It is not likely any of the other major sound file
  102.         formats will be supported.  Thre are many tools which
  103.         can convert to/from these formats.  However,
  104.         I will make an effort to support any standard format which
  105.         allows you to specify finetune, names, and loop points
  106.         so that all of the sample information can be encoded.
  107.  
  108.   -p prefix = prefix of sample output files (defaults to inst)
  109.   -s suffix = suffix of sample output files (override format default)
  110.  
  111.     Note:    Use the forward slash (/) to separate directories instead
  112.         of the backward slash, even in MSDOS.
  113.     Note:    -p and -s are only useful when the format is not
  114.         internal.
  115.     Note:    The name of the files created will be
  116.             <prefix>nn<suffix>
  117.         where nn is the sample # (0 thru 31 in most .mod files).
  118.     Note:     When specifying a prefix, you can give a leading
  119.         directory path.  Use the forward slash (/) to separate
  120.         directories instead of the backward slash, even in MSDOS.
  121.     Note:    Make sure you leave enough room to hold the extra 2 digits
  122.         generated.  Some filesystems (namely MSDOS) have filename
  123.         length limits.
  124.     Note:    The suffix defaults as follows:
  125.             -f w or -f w1    .wav
  126.             -f s        .sam
  127.             -f a        .txt
  128.  
  129.  file.mod = input file
  130.  
  131.     Note:    MED, S3M, STM, and other formats are not supported at
  132.         this time.  This is mainly due to the lack of useable
  133.         documentation on the file formats.  If you have some
  134.         docs, you are welcomed to send them to me.
  135.  
  136.  file.dis = output file
  137.  
  138.     Note:    The output normally goes to the terminal unless you redirect
  139.         it.
  140.     Note:    Some mod files can generate dis-assemblies over 4 Mb. in
  141.         size.  Use the -np and -ns, or -f options to limit the
  142.         material written to the dis-assembly.
  143.     Note:    Some text editors may fail to load very large dis-assemblies.
  144.         Get a better editor.
  145.  
  146. Examples:
  147.  
  148.     mod_dis -v -f w -p abc abc.mod > abc.dis
  149.  
  150.     - dis-assemble abc.mod to abc.dis, samples will be written
  151.       to abc0.wav, abc1.wav, etc...
  152.     
  153.     mod_dis -np -ns abc.mod > abc.dis
  154.  
  155.     - dis-assemble only the header information of abc.mod
  156.  
  157. Diagnostics:
  158.  
  159.     Generally speaking, if you get error messages, its likely that
  160.     the .mod file is not in the standard mod format.  If you dont
  161.     understand the error message, look at the documentation for
  162.     mod file formats and the source code.
  163.  
  164.     mod_dis is fairly pessimistic when it finds something that is
  165.     not standard.  Use the "-v -v" flag to see all the warnings.
  166.     Due to the wide variety of Mod trackers in use, there are
  167.     many interpretations of the mod format specification in popular
  168.     programs.
  169.  
  170.     If you are absolutely sure your mod file is standard and contains
  171.     no errors, send me some e-mail and I'll check it out.  It could
  172.     well be that the program has bugs.
  173.  
  174. Disassembled mod output:
  175.  
  176.     The output is created in such a way as so it can be fed as input
  177.     to the companion program "modcomp" to re-compile it into a .mod
  178.     file.  The language specification is still evolving so whem
  179.     modcomp is released, it is likely that an updated mod_dis will
  180.     be released.  The output format may be changed slightly.
  181.  
  182.     The sample info (length, repeat offset, repeat length) is printed
  183.     out in bytes.  This is the most portable.  The dummy amiga
  184.     word is not included, only the real sample information.
  185.     This avoids any confusion about whether to add or subtract, and
  186.     converting from words to bytes.  Let modcomp do the work for you.
  187.  
  188.     It is common practice to have sample names which have nothing to 
  189.     do with the sample itself, sometimes even have a sample name
  190.     for a sample with no data.  These are included in the disassembly.
  191.  
  192.     Sometimes non-ascii characters are used in sample names, presumably
  193.     they display as interesting graphical characters on some machines.
  194.     Those characters may or may not be put in the disassembly
  195.     correctly, and may or may not display right in your text editor.
  196.     It is an unportable use and is discouraged.  Future implementations
  197.     may strip unportable characters.
  198.  
  199.     C++ style comments are sometimes placed in the output.  Modcomp
  200.     will ignore everything from the // to the end-of-line.
  201.  
  202. Bugs:
  203.  
  204.     mod_dis does not like backslash (\) in the prefix or suffix (-p and
  205.     -s command line options).  Use / when you mean \.
  206.     
  207.     mod_dis and modcomp will NOT play mod files - there are plenty
  208.     of programs out there that do.
  209.  
  210.     Some mod formats not supported.  Without detailed documentation
  211.     and standardization, they may never be supported.  Perhaps you can
  212.     convert it to a standard mod format for dis-assembly.  I would like
  213.     to see a standard format for unlimited sample size, 16 bit sample
  214.     width, unlimited pattern length and table.  It ought to make better
  215.     quality mods.
  216.  
  217.     mod_dis doesn't understand any of the compression techniques used
  218.     to pack mod files.
  219.  
  220.     mod_dis will not operate on mod files in archives.
  221.  
  222. Files:
  223.     The executable 'mod_dis.exe' is supplied, which is an executable
  224.     for MSDOS.  For all other systems, you will need to compile from 
  225.     the sources.  The MSDOS executable is built using Microsoft
  226.     Visual C++ 1.0, using the large memory model.
  227.  
  228.     The sources consist of misc.c, mod_dis.c, mod_disv.c, wav.h,
  229.     wav.c, misc.h, modcomp.h.  makefile.unx is provided for unix
  230.     systems, to compile just "make -f makefile.unx".
  231.     
  232.     Text files
  233.     are provided in msdos text format, you will need to convert them
  234.     to unix format for best results.  You can use this shell command:
  235.  
  236.         sed 's/^M//' < dos_text_file > unix_text_file
  237.          (the ^M is a control-M, you may need to escape it with
  238.           a backslash or control-V depending on the shell)
  239.  
  240.     mod_dis.mak is provided to use by the Microsoft Visual C++ 1.0
  241.     compiler.  Use the .mak as the project file in the IDE, or
  242.     on the command line you can "nmake -f mod_dis.mak".  I think
  243.     debugging is enabled in the project.
  244.  
  245.     A sample mod file and dis-assembly is given as a reference
  246.     example (taken from the Sound-Site CD-ROM).  It was generated
  247.     using the shell command
  248.  
  249.         mod_dis -v -v drave.mod > drave.rpt 2> drave.err
  250.  
  251.     
  252.  
  253. Porting:
  254.  
  255.     There is generous use of casts to avoid warnings emitted by
  256.     the Microsoft compiler.
  257.  
  258.     There is a lot of kludgey code in MSDOS because "int" is 16 bits.
  259.  
  260.     The program prefers an ANSI compliant compiler, but does compile
  261.     using the sunos compiler.  (__STDC__ not defined).  It has
  262.     not been tested on a Solaris compiler, or the GNU compiler.
  263.  
  264.     Look in the misc.h file, you want to make sure the correct endian-ness
  265.     is set.  Also there are a bunch of stuff that depends on __MSDOS__
  266.     being set, which may or may not need to be set if you use a compiler
  267.     other than Microsoft.
  268.  
  269.     There is a function "verify_port()" in mod_dis.c, look over the
  270.     code and make sure it runs properly for the machine you port to.
  271.  
  272.     There seems to be 2 schools of thought on the interpretation of
  273.     the repeat length.  The macro RPT_LENGTH_IS_INCR defines which
  274.     way the program defaults to.  As currently set, repeat length
  275.     is interpreted as including the amiga dummy word.
  276.  
  277. Testing:
  278.     mod_dis is tested on approx 1000 mod files taken from the AMINET
  279.     archive.  Of the 1000 files, there are approx 630 standard mod
  280.      format files (the rest predominently med, stm, packed).  Of the
  281.     630 only 2 fail to disassemble.  I haven't looked in close detail
  282.     at why.
  283.  
  284.     It has also been tested on 1365 mod files on the Sound-site 
  285.     CD-ROM - only 2 files there fail to disassemble.  ( There are
  286.     other failures but they are legitimate, they were on files
  287.     in the bad and corrupt directories.) 
  288.  
  289.     The wav files generated have been tested on several .wav editors,
  290.     and several .wav players playing on a SoundBlaster 16 on a PC
  291.     running windows 3.1.  I've only found 1 program required the "-f w1"
  292.     .wav files: Microsoft wavedit.exe - it didnt like the non-standard
  293.     playback rate.
  294.  
  295. References:
  296.  
  297.     mod file format documentation, by THUNDER (kurtt@sfu.ca)
  298.     Advanced Music Formats Document, By Jamal Hannah jamal@bronze.lcs.mit.edu
  299.     mod format info, by Lars Hamre <larsha@lise.unit.no>
  300.     RIFF WAVE (.WAV) file format, by Microsoft, transcribed by 
  301.         Rob Ryan <ST802200@brownvm.brown.edu>
  302.  
  303.  
  304. Special thanks to kurtt@sfu.ca for answering many questions on mod file format.
  305.  
  306.  
  307. /* BEGIN DAVID LAI COPYRIGHT ********************************************* */
  308. /*
  309. (C) Copyright David Lai 1993, 1994.  All rights reserved.
  310.  
  311. The source code is copyright by David Lai, however it is freely
  312. distributable and released for unrestricted use.  Users may copy or modify 
  313. this source code without charge, provided all copyright
  314. notices remain intact in all the source code.  Portions of the source code
  315. copyright by their respective copyright holders and are covered
  316. under different agreements, however the source code used has
  317. specifically been marked distributable royalty-free.
  318.  
  319. You can do whatever you want with it, even charge money for it, if
  320. you find a sucker willing to pay for it.  This is not shareware, the program
  321. is not crippled in any way, do not send money.  You can e-mail comments
  322. to the electronic mail address below, or fax to the fax number below.
  323.  
  324. If you add a feature thats useful, or do a new port, you can send
  325. the context diffs to the e-mail address below.  I may include it in
  326. subsequent releases.  Your code must specifically be marked
  327. freely distributable, I will not include code marked otherwise.
  328.  
  329. THE SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
  330. THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  331. PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  332.  
  333. The source code is provided with no support and without any obligation on
  334. the part of David Lai to assist in its use, correction,
  335. modification or enhancement.
  336.  
  337. DAVID LAI SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  338. INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
  339. OR ANY PART THEREOF.
  340.  
  341. In no event will David Lai be liable for any lost revenue
  342. or profits or other special, indirect and consequential damages, even if
  343. David Lai has been advised of the possibility of such damages.  Etc, etc,
  344. blah, blah, blah...
  345.  
  346. David Lai
  347. 1370 McKendrie St
  348. San Jose, CA 95126
  349. fax: 408-241-4615
  350.  
  351. lai%fastfood@daver.bungi.com
  352.  
  353. */
  354. /* END   DAVID LAI COPYRIGHT ********************************************* */
  355.